﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using KnowledgeCommunity.Model;
using KnowledgeCommunity.Service;
using KnowledgeCommunity.Web.Models;
using KnowledgeCommunity.Web.DbHelper;
using System.IO;

namespace KnowledgeCommunity.Web.Controllers
{
    public class HomeController : Controller
    {
        SliderHelper mySliderHelper = new SliderHelper();
        KnowledgeHelper myKnowledgeHelper = new KnowledgeHelper();
        CommodityHelper myCommodityHelper = new CommodityHelper();
        TopicHelper myTopicHelper = new TopicHelper();
        DocumentHelper myDocumentHelper = new DocumentHelper();
        UserAccountHelper myUserAccountHelper = new UserAccountHelper();

        public ActionResult Index()
        {
            ViewData["SliderList"] = mySliderHelper.FindTop(6);
            ViewData["CommodityList"] = myCommodityHelper.FindTop(8);
            ViewData["KnowledgeList"] = myKnowledgeHelper.FindTop(8);
            ViewData["TopicList"] = myTopicHelper.FindTop(8);
            ViewData["DocumentList"] = myDocumentHelper.FindTop(8);

            return View();
        }

        public ActionResult About()
        {
            ViewData["TopicList"] = myTopicHelper.FindByBelongTo(2);
            return View();
        }

        public ActionResult Contact()
        {
            var model = myTopicHelper.FindByBelongTo(3);
            ViewData["TopicList"] = model;
            return View();
        }

    }
}
